/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.ac.iie.di.ban.ycl.bk.e2p.ysyb.tools;

import cn.ac.iie.di.ban.ycl.bk.e2p.ysyb.thread.BKThread;
import cn.ac.iie.di.ban.ycl.bk.e2p.ysyb.service.FJRThreadTask;
import java.io.File;
import java.util.List;
import org.apache.log4j.Logger;

/**
 *
 * @author wmr
 */
public class CompanyFolder {
    
    private static Logger logger = Logger.getLogger(CompanyFolder.class);
    
    public void execute(String path) {

        File file = new File(path);
        if (file.exists()) {
            File[] files = file.listFiles();
            if (files.length == 0) {
                logger.info("文件夹是空的!");
                return;
            } else {
                for (File file2 : files) {
                    if (file2.isDirectory()) {
                        logger.info("文件夹:" + file2.getAbsolutePath());
                        String localPath = file2.getAbsolutePath();
                        BKThread bkT = new BKThread(localPath);
                        Thread bt = new Thread(bkT);
                        bt.start();
                    } else {
                        logger.fatal(file2.getAbsolutePath() + " 不是任务目录 。");
                        continue;
                    }
                }
            }
        } else {
            logger.info(path + " 文件夹不存在!");
        }
    }
}
